package com.tlsy.commerce.controller;

import com.tlsy.commerce.model.User;
import com.tlsy.commerce.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author Tlsy
 * @version commerce 0.0.1
 * @date 2017/4/22  11:24
 */
@Controller
public class RegisterController extends BaseController {

    @Autowired
    private SystemService systemService;

    @RequestMapping(value="/register",method = RequestMethod.GET)
    public String registerGet(){

        return "/register";
    }

    @RequestMapping(value = "/register",method = RequestMethod.POST)
    public String registerPost(User user){
        systemService.register(user);
        return "/login";
    }
}
